﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  xmlns:inputToolkit="clr-namespace:System.Windows.Controls">
  <Style
    TargetType="inputToolkit:TimeUpDown">
    <Setter
      Property="BorderThickness"
      Value="1" />
    <Setter
      Property="Background"
      Value="Transparent" />
    <Setter
      Property="Height"
      Value="22" />
    <Setter
      Property="IsTabStop"
      Value="False" />
    <Setter
      Property="MinWidth"
      Value="100" />
    <Setter
      Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush
          EndPoint="0.5,1"
          StartPoint="0.5,0">
          <GradientStop
            Color="#FFA3AEB9"
            Offset="0" />
          <GradientStop
            Color="#FF8399A9"
            Offset="0.375" />
          <GradientStop
            Color="#FF718597"
            Offset="0.375" />
          <GradientStop
            Color="#FF617584"
            Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter
      Property="Template">
      <Setter.Value>
        <ControlTemplate
          TargetType="inputToolkit:TimeUpDown">
          <Grid>
            <!-- visual states -->
            <vsm:VisualStateManager.VisualStateGroups>
              <!-- common states-->
              <vsm:VisualStateGroup
                x:Name="CommonStates">
                <!-- all contained elements are controls that will take
                    care of visualizing the disabled state themselves -->
                <vsm:VisualStateGroup.Transitions>
                  <vsm:VisualTransition
                    GeneratedDuration="0" />
                </vsm:VisualStateGroup.Transitions>
                <vsm:VisualState x:Name="Normal" />
                <vsm:VisualState x:Name="MouseOver" />
                <vsm:VisualState x:Name="Pressed" />
                <vsm:VisualState x:Name="Disabled" />
              </vsm:VisualStateGroup>
              <!-- focus states -->
              <vsm:VisualStateGroup
                x:Name="FocusStates">
                <!-- all contained elements are controls that will take
                    care of visualizing the focus state themselves -->
                <vsm:VisualState x:Name="Focused" />
                <vsm:VisualState x:Name="Unfocused" />
              </vsm:VisualStateGroup>
              <!-- TimeHintStates -->
              <vsm:VisualStateGroup
                x:Name="TimeHintStates">
                <vsm:VisualState
                  x:Name="TimeHintOpenedUp">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame
                        KeyTime="00:00:00"
                        Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                      <SplineDoubleKeyFrame
                        KeyTime="00:00:00.200"
                        KeySpline="0,0,0,1"
                        Value="-23" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="Height">
                      <DiscreteDoubleKeyFrame
                        KeyTime="00:00:00"
                        Value="0" />
                      <SplineDoubleKeyFrame
                        KeyTime="00:00:00.200"
                        KeySpline="0,0,0,1"
                        Value="22" />
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState
                  x:Name="TimeHintOpenedDown">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame
                        KeyTime="00:00:00"
                        Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                      <SplineDoubleKeyFrame
                        KeyTime="00:00:00.200"
                        KeySpline="0,0,0,1"
                        Value="0" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="Height">
                      <DiscreteDoubleKeyFrame
                        KeyTime="00:00:00"
                        Value="0" />
                      <SplineDoubleKeyFrame
                        KeyTime="00:00:00.200"
                        KeySpline="0,0,0,1"
                        Value="22" />
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState
                  x:Name="TimeHintClosed">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame
                        KeyTime="00:00:20"
                        Value="Collapsed" />
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                      <SplineDoubleKeyFrame
                        KeyTime="00:00:00.200"
                        KeySpline="0,0,0,1"
                        Value="0" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="TimeHintVisualElement"
                      Storyboard.TargetProperty="Height">
                      <DiscreteDoubleKeyFrame
                        KeyTime="00:00:00"
                        Value="22" />
                      <SplineDoubleKeyFrame
                        KeyTime="00:00:00.200"
                        KeySpline="0,0,0,1"
                        Value="0" />
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <!-- ParsingStates -->
              <vsm:VisualStateGroup
                x:Name="ParsingStates">
                <vsm:VisualState
                  x:Name="ValidTime">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="validicon"
                      Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame
                        KeyTime="00:00:00"
                        Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState
                  x:Name="InvalidTime">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="invalidicon"
                      Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame
                        KeyTime="00:00:00"
                        Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState
                  x:Name="EmptyTime">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames
                      BeginTime="00:00:00"
                      Storyboard.TargetName="emptyicon"
                      Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame
                        KeyTime="00:00:00"
                        Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>
            <!-- Spinner + HintVisualElement + TextBox -->
            <!-- the border will be 'flown out' to act as a balloon -->
            <Popup
              x:Name="TimeHintPopup"
              VerticalOffset="0">
              <Border
                x:Name="TimeHintVisualElement"
                IsHitTestVisible="True"
                BorderBrush="Gray"
                Background="White"
                Visibility="Collapsed"
                HorizontalAlignment="Left"
                BorderThickness="1">
                <Border.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform />
                    <SkewTransform />
                    <RotateTransform />
                    <TranslateTransform />
                  </TransformGroup>
                </Border.RenderTransform>
                <Grid>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition
                      Width="Auto"
                      MinWidth="15" />
                  </Grid.ColumnDefinitions>
                  <ContentControl
                    Grid.Column="0"
                    IsTabStop="False"
                    IsHitTestVisible="False"
                    Margin="3"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Foreground="#FF4A4A4A"
                    FontSize="10"
                    Content="{TemplateBinding TimeHintContent}" />
                  <ContentControl
                    x:Name="emptyicon"
                    IsTabStop="False"
                    IsHitTestVisible="False"
                    Margin="3"
                    Visibility="Collapsed"
                    Grid.Column="1" />
                  <ContentControl
                    x:Name="validicon"
                    IsHitTestVisible="False"
                    IsTabStop="False"
                    Margin="3"
                    Visibility="Collapsed"
                    Grid.Column="1" />
                  <ContentControl
                    x:Name="invalidicon"
                    IsTabStop="False"
                    IsHitTestVisible="False"
                    Visibility="Collapsed"
                    VerticalAlignment="Center"
                    Grid.Column="1">
                    <Grid
                      VerticalAlignment="Bottom"
                      Width="10"
                      Height="13">
                      <Path
                        Stretch="Fill"
                        Data="F1 M 28.1143,29.4857L 28.1143,27.4286L 20.7612,13.0286L 19.3898,13.0286L 12.3429,27.4286L 12.3429,29.4857L 28.1143,29.4857 Z "
                        StrokeStartLineCap="Round"
                        StrokeEndLineCap="Round"
                        StrokeLineJoin="Bevel"
                        Height="11.833"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Top">
                        <Path.Stroke>
                          <LinearGradientBrush
                            StartPoint="1.10074,0.462591"
                            EndPoint="-0.102151,0.462591">
                            <GradientStop
                              Color="#F6CAA709"
                              Offset="0.0436364" />
                            <GradientStop
                              Color="#F3F7F34F"
                              Offset="0.149091" />
                            <GradientStop
                              Color="#E7CAA709"
                              Offset="0.825455" />
                            <GradientStop
                              Color="#E7967C07"
                              Offset="0.967124" />
                            <GradientStop
                              Color="#E7625106"
                              Offset="0.967273" />
                          </LinearGradientBrush>
                        </Path.Stroke>
                        <Path.Fill>
                          <LinearGradientBrush
                            StartPoint="1.13883,0.460318"
                            EndPoint="-0.140331,0.460318">
                            <GradientStop
                              Color="#FFF7F79F"
                              Offset="0.123636" />
                            <GradientStop
                              Color="#FBFBFB7D"
                              Offset="0.177662" />
                            <GradientStop
                              Color="#F6FFFF5B"
                              Offset="0.24" />
                            <GradientStop
                              Color="#E7CAA709"
                              Offset="0.52" />
                            <GradientStop
                              Color="#9ADABE0C"
                              Offset="0.941376" />
                            <GradientStop
                              Color="#4DEBD60F"
                              Offset="0.941818" />
                            <GradientStop
                              Color="#FBF6EC20"
                              Offset="0.956364" />
                            <GradientStop
                              Color="#FFFFFF2F"
                              Offset="0.963636" />
                          </LinearGradientBrush>
                        </Path.Fill>
                      </Path>
                      <Path
                        Stretch="Fill"
                        StrokeThickness="0.3"
                        StrokeStartLineCap="Round"
                        StrokeEndLineCap="Round"
                        StrokeLineJoin="Bevel"
                        Stroke="#FF1B1B54"
                        Data="F1 M 18.6937,17.3004L 22.2563,17.3004L 21.1313,23.6937L 19.8563,23.6937L 18.6937,17.3004 Z "
                        Margin="4.25,2.25,3.75,0"
                        Height="4.683"
                        VerticalAlignment="Top">
                        <Path.Fill>
                          <LinearGradientBrush
                            StartPoint="-0.400002,0.50126"
                            EndPoint="1.4,0.50126">
                            <GradientStop
                              Color="#FFF7F79F"
                              Offset="0.123636" />
                            <GradientStop
                              Color="#FB8F8873"
                              Offset="0.175974" />
                            <GradientStop
                              Color="#F6271A47"
                              Offset="0.236364" />
                            <GradientStop
                              Color="#E7271A47"
                              Offset="0.534545" />
                            <GradientStop
                              Color="#9A89782B"
                              Offset="0.941391" />
                            <GradientStop
                              Color="#4DEBD60F"
                              Offset="0.941818" />
                            <GradientStop
                              Color="#FBF6EC20"
                              Offset="0.956364" />
                            <GradientStop
                              Color="#FFFFFF2F"
                              Offset="0.963636" />
                          </LinearGradientBrush>
                        </Path.Fill>
                      </Path>
                      <Path
                        Height="3.11"
                        Stretch="Fill"
                        StrokeThickness="0.3"
                        StrokeStartLineCap="Round"
                        StrokeEndLineCap="Round"
                        StrokeLineJoin="Round"
                        Stroke="#FF1C1C50"
                        Data="F1 M 20.225,25.122L 20.725,25.122C 21.2773,25.122 21.725,25.5697 21.725,26.122L 21.725,26.872C 21.725,27.4243 21.2773,27.872 20.725,27.872L 20.225,27.872C 19.6727,27.872 19.225,27.4243 19.225,26.872L 19.225,26.122C 19.225,25.5697 19.6727,25.122 20.225,25.122 Z "
                        Margin="3.833,0,4.167,0.833"
                        VerticalAlignment="Bottom">
                        <Path.Fill>
                          <LinearGradientBrush
                            StartPoint="-0.0599991,0.5"
                            EndPoint="1.06,0.5">
                            <GradientStop
                              Color="#F6271A47"
                              Offset="0.236364" />
                            <GradientStop
                              Color="#E7271A47"
                              Offset="0.534545" />
                            <GradientStop
                              Color="#9A89782B"
                              Offset="0.98135" />
                            <GradientStop
                              Color="#4DEBD60F"
                              Offset="0.981818" />
                          </LinearGradientBrush>
                        </Path.Fill>
                      </Path>
                    </Grid>
                  </ContentControl>
                </Grid>
              </Border>
            </Popup>
               <inputToolkit:ButtonSpinner
                x:Name="Spinner"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Padding="{TemplateBinding Padding}"
                Style="{TemplateBinding SpinnerStyle}"
                MinWidth="35"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                IsTabStop="False">
              <TextBox
                x:Name="Text"
                BorderThickness="0"
                FontFamily="{TemplateBinding FontFamily}"
                FontSize="{TemplateBinding FontSize}"
                FontStretch="{TemplateBinding FontStretch}"
                FontStyle="{TemplateBinding FontStyle}"
                FontWeight="{TemplateBinding FontWeight}"
                Foreground="{TemplateBinding Foreground}"
                MinWidth="20"
                AcceptsReturn="False"
                Text="{TemplateBinding Value}"
                TextAlignment="Right"
                TextWrapping="NoWrap">
                <TextBox.Style>
                  <Style
                    TargetType="TextBox">
                    <Setter
                      Property="Template">
                      <Setter.Value>
                        <ControlTemplate
                          TargetType="TextBox">
                          <ScrollViewer
                            x:Name="ContentElement"
                            Padding="0"
                            BorderThickness="0" />
                        </ControlTemplate>
                      </Setter.Value>
                    </Setter>
                  </Style>
                </TextBox.Style>
              </TextBox>
            </inputToolkit:ButtonSpinner>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>
